package com.xxxtentacion.mr.exam.step2;

import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
/**
 * @author urboifrdscks!
 */
public class ExamBean implements WritableComparable<ExamBean> {
    private Integer key;


    public ExamBean() {
    }

    public ExamBean(Integer key) {
        this.key = key;
    }

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    @Override
    public int compareTo(ExamBean o) {

        return -o.getKey().compareTo(this.key);
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeInt(key);
    }

    @Override
    public void readFields(DataInput in) throws IOException {

        this.key=in.readInt();
    }

    @Override
    public String toString() {
        return key+"";
    }

}
